from CloudEngine.IO.ElectromagnetismDataReader import ElectromagnetismDataReader
from CloudEngine.core.PointCloudActor import PointCloudActor


def read_eb_data(service, file_path, is_remote=False):
    reader = ElectromagnetismDataReader()
    if is_remote:
        reader.read_from_remote(file_path)
    else:
        reader.read(file_path)
    actor = PointCloudActor(reader.get_poly_data(), reader.get_scalar_range())
    service.app.add(actor)
    service.app.renderer.ResetCamera()
